#include <iostream>
#include <pthread.h>
#include <sys/types.h>

using namespace std;

void* thread (void* buff)
{
	string arg = *(string*)buff;
	struct timeval timer;
	int maxfdp1, i;
	//i = 0;
	//while (true)
	{
		int maxfd = 0;
		timer.tv_sec = 1;
		timer.tv_usec = 0;
		maxfdp1 = maxfd + 1;
		//select(maxfd, NULL, NULL, NULL, &timer);
		for (i = 0; i < 5; i++)
		{
			cout << arg << i << endl;
		}
		//i++;
		//if (i > 5)
		{
			//break;
		}
	}

}

int main ()
{
	pthread_t tid;
	string buff = "nihao!";
	int temp = 798;
	pthread_create(&tid, NULL, thread, (void*)&buff);
	pthread_join(tid, 0);
	for (int j = 0; j < 5; j++)
	{
		cerr << "main thread over." << j << endl;
	}
	return 0;
}

